package com.oxygen.fastfile.core.factory;

import com.oxygen.fastfile.core.strategy.AliyunOssFileStorageStrategy;
import com.oxygen.fastfile.core.strategy.AwsS3FileStorageStrategy;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wangjie
 * @version V1.0
 * @title: FileStrategyFactory
 * @package: com.oxygen.fastfile.core.factory
 * @description: TODO
 * @date 2022/3/26 21:39
 **/
public class FileStorageStrategyFactory {

    private static FileStorageStrategyFactory factory = new FileStorageStrategyFactory();

    private FileStorageStrategyFactory() {
    }

    private static Map strategyMap = new HashMap<>(16);

    static {
        strategyMap.put("ALIYUNOSS", new AliyunOssFileStorageStrategy());
        strategyMap.put("AWSS3", new AwsS3FileStorageStrategy());
    }

    public FileStorageStrategyFactory create(String storagePlatform) {
        return (FileStorageStrategyFactory) strategyMap.get(storagePlatform);
    }

    public static FileStorageStrategyFactory getInstance() {
        return factory;
    }

}
